package com.jy.api.dao;

import com.jy.api.domain.ReferralCode;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import static org.junit.Assert.assertNotNull;

/**
 * Created by hanxi on 2017/8/20.
 */
public class ReferralCodeDaoIT extends BaseDaoIT {
    @Autowired
    private ReferralCodeDao dao;

    @Test
    public void given_exist_when_find_by_referral_code_then_return() {
        // given
        ReferralCode code = new ReferralCode();
        code.setIdCardCode("511181198211281115");
        code.setMobile("15308039727");
        code.setReferralCode("hxbs00100");
        dao.save(code);

        // when
        ReferralCode saved = dao.findByReferralCode("hxbs00100");

        // then
        assertNotNull(saved);
    }
}
